using Medical.Domain.DepartmentInfo;
using Medical.Domain.Enum;
using System.ComponentModel.DataAnnotations;

namespace Medical.Api.Write.Dto.DepartmentManagement
{
    /// <summary>
    /// 回收申请请求数据传输对象
    /// </summary>
    public class RecyclingRequestDto
    {
        /// <summary>
        /// 回收申请表数据
        /// </summary>
        [Required(ErrorMessage = "回收表数据不能为空")]
        public RecyclingTableDto RecyclingTable { get; set; }

        /// <summary>
        /// 物品表数据列表
        /// </summary>
        public List<ItemTable> ItemTables { get; set; }
    }

    /// <summary>
    /// 回收表数据传输对象
    /// </summary>
    public class RecyclingTableDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 物品的Id
        /// </summary>
        public int ItemId { get; set; }

        /// <summary>
        /// 使用日期
        /// </summary>
        public DateTime UseTime { get; set; }

        /// <summary>
        /// 申请时间
        /// </summary>
        public DateTime ApplicationTime { get; set; }

        /// <summary>
        /// 申请人
        /// </summary>
        public string ApplicationPerson { get; set; }

        /// <summary>
        /// 接收单位(供应商)
        /// </summary>
        public SupplierEnum ReceptionUnit { get; set; }

        /// <summary>
        /// 是否紧急
        /// 1:是   2:否
        /// </summary>
        public int Urgent { get; set; }
        /// <summary>
        /// 回收状态
        /// 1:提交   2:接受
        /// </summary>
        public int RecyclingStatus { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 将DTO转换为实体
        /// </summary>
        /// <returns>回收表实体</returns>
        public RecyclingTable ToEntity()
        {
            return new RecyclingTable
            {
                Id = this.Id,
                ItemId = this.ItemId,
                UseTime = this.UseTime,
                ApplicationTime = this.ApplicationTime,
                ApplicationPerson = this.ApplicationPerson,
                ReceptionUnit = this.ReceptionUnit,
                Urgent = this.Urgent,
                RecyclingStatus = this.RecyclingStatus,
                Remark = this.Remark
            };
        }
    }
} 